~ chicken-core (chicken-5) /manual/Module (chicken time)


 1[[tags: manual]]
 2[[toc:]]
 3
 4== Module (chicken time)
 5
 6This module provides a few basic procedures for measuring time.
 7For representation and manipulation of calendar time, see
 8[[Module (chicken time posix)]].
 9
10=== Retrieving timestamp information
11
12==== cpu-time
13
14<procedure>(cpu-time)</procedure>
15
16Returns the used CPU time of the current process in milliseconds as
17two values: the time spent in user code, and the time spent in system
18code. On platforms where user and system time can not be differentiated,
19system time is always 0.
20
21
22==== current-process-milliseconds
23
24<procedure>(current-process-milliseconds)</procedure>
25
26Returns the number of milliseconds since process startup.
27
28
29==== current-seconds
30
31<procedure>(current-seconds)</procedure>
32
33Returns the number of seconds since midnight, Jan. 1, 1970.
34
35
36=== Benchmarking macros
37
38==== time
39
40<macro>(time EXP1 ...)</macro>
41
42Performs a major garbage collection, evaluates {{EXP1 ...}} and prints
43elapsed CPU time and some values about GC use, like time spent in
44major GCs, number of minor and major GCs. The output is sent to the
45port that is the current value of {{(current-error-port)}}. Nested
46invocations of this form will give incorrect results for all output
47but the innermost.
48
49
50---
51Previous: [[Module (chicken tcp)]]
52
53Next: [[Module (chicken time posix)]]
Trap